package com.ces.knacky.restws.client;

import java.io.ByteArrayInputStream;

import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.DeleteMethod;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.PutMethod;
import org.apache.commons.httpclient.methods.RequestEntity;
import org.apache.commons.httpclient.methods.InputStreamRequestEntity;
import org.apache.commons.httpclient.methods.StringRequestEntity;
import org.apache.webdav.lib.methods.PostMethod;




public class TestCheckoutRService {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		
		
		
		
		
				

			   
		
			   //Place Order
			   PostMethod postMethod = new PostMethod("http://localhost:8080/eAuction/rest/checkoutService/1,2,3");
			   
			   //Fetch Order
			   GetMethod getMethod = new GetMethod("http://localhost:8080/eAuction/rest/checkoutService/admin/1");
			   

		

			     

			   HttpClient client = new HttpClient();  

			  try {  
				  int result;
				 
				 			      
		
			      
	    	      
				  //Place Order
				  result = client.executeMethod(postMethod);
				  
				  System.out.println(postMethod.getResponseBodyAsString(2000));
				  
				  getMethod.setRequestHeader("Accept", "application/json");
				  result = client.executeMethod(getMethod);
				  
				  System.out.println(getMethod.getResponseBodyAsString(4000));
			      
			 
			  }
			  catch(Exception ex)
			  {
				  ex.printStackTrace();
			  }
			  finally {  

			     postMethod.releaseConnection();  

			  }  


	

}
	
}
